package work.huangxin.share.mapper;

import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import work.huangxin.share.domain.sechand.SechandBuyGoods;

import java.util.List;


@Mapper
public interface SechandBuyGoodsMapper extends tk.mybatis.mapper.common.Mapper<SechandBuyGoods> {
    /**
     * 分页查询所有求购商品的信息
     * @return
     */
    Page<SechandBuyGoods> selectPageSechandBuyGoodsList();

    /**
     * 根据id查询求购商品的信息
     * @param id
     * @return
     */
    SechandBuyGoods selectSechandBuyGoodsById(Integer id);



    /**
     * 用户查询自己发布的求购商品
     * @param userId
     * @return
     */
    List<SechandBuyGoods> selectSechandBuyGoodsByUserId(Integer userId);

    /**
     * 更新自己求购商品的信息
     * @param sechandBuyGoods
     * @return
     */
    int updateBuyGoods(SechandBuyGoods sechandBuyGoods);

    /**
     * 根据搜索查询求购商品
     * @param keyword
     * @return
     */
    List<SechandBuyGoods> getBuyGoodsByKeyWord(@Param("keyword") String keyword);

    /**
     * 删除求购商品
     * @param userId
     * @param goodsId
     * @return
     */
    int deleteBuyGoods(@Param("userId") Integer userId, @Param("goodsId") Integer goodsId);

    /**
     * 下架求购商品
     * @param userId
     * @param goodsId
     * @return
     */
    int setBuyGoodsIsBuied(@Param("userId") Integer userId,@Param("goodsId") Integer goodsId);

    int deleteBuyGoodsByAdmin(@Param("goodsId")Integer goodsId, @Param("hasBuied") Integer hasBuied);

    int deleteBuyGoodsBy(@Param("goodsId") Integer goodsId);
}
